Make mtk_logger use the system tmp directory (/tmp or the one pointed by TMPDIR or...
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 20 Jul 2014 22:23:47 +0000 (22:23 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 20 Jul 2014 22:23:47 +0000 (22:23 +0000)
holds the device's memory.

gpsbabel/mtk_logger.cc
gpsbabel/xmldoc/formats/mtk.xml

index 1fdf6c02a22bbb87ca6376061f80948483ce7899..2d144cecc574a3b45c359f10d51ba1c8445a8a2a 100644 (file)
@@ -56,6 +56,8 @@
 #include <errno.h>
 #include <math.h>
 
+#include <QtCore/QDir>
+
 #include "defs.h"
 #include "gbser.h"
 #include "gbfile.h" /* used for csv output */
@@ -230,9 +232,6 @@ static enum MTK_DEVICE_TYPE mtk_device = MTK_LOGGER;
 struct mtk_loginfo mtk_info;
 
 const char LIVE_CHAR[4] = {'-', '\\','|','/'};
-static const char TEMP_DATA_BIN[]= "data.bin";
-static const char TEMP_DATA_BIN_OLD[]= "data_old.bin";
-
 
 const char CMD_LOG_DISABLE[]= "$PMTK182,5*20\r\n";
 const char CMD_LOG_ENABLE[] = "$PMTK182,4*21\r\n";
@@ -281,6 +280,27 @@ static void dbg(int l, const char* msg, ...)
   }
   va_end(ap);
 }
+
+// Returns a fully qualified pathname to a temporary file that is a copy
+// of the data downloaded from the device. Only two copies are ever in play,
+// the primary (e.g. "/tmp/data.bin") and the backup ("/tmp/data_old.bin").
+//
+// It returns a temporary C string - it's totally kludged in to replace
+// TEMP_DATA_BIN being string constants.
+static const char* GetTempName(bool backup) {
+  const char kData[]= "data.bin";
+  const char kDataBackup[]= "data_old.bin";
+
+  QString t = QDir::tempPath(); 
+  t += QDir::separator();
+  t += backup ? kDataBackup : kData;
+  // If your temp directory isn't representable in Latin1, you're going to 
+  // have a bad day.
+  return t.toLatin1();
+}
+#define TEMP_DATA_BIN GetTempName(false)
+#define TEMP_DATA_BIN_OLD GetTempName(true)
+
 static int do_send_cmd(const char* cmd, int cmdLen)
 {
   int rc;
index 9276ca1f25edde6d9fe5f6c7e4804eeedc5d12df..a665412c88c8bce440c2bcab1669ffba56d59537 100644 (file)
@@ -65,7 +65,10 @@ If you can confirm success with others, please share with us.
   frequently pair this with commodity USB/Serial converter internally.  So
   these devices typically look like Prolific, FTDI, or Silab usb/serial 
   devices to the host OS.  You'll need drivers for that whatever chip 
-  your product uses for your operating system.
+  your product uses for your operating system.  For the "A+ GPS Recorder",
+  the <link linkend="http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx">Silicon Labs CP210x chip</link> is used.  On OS/X, you'll get
+  awesome device names like /dev/cu.usbmodem1d13410 - fortunately, our GUI
+  makes that multiple choice so you don't have to guess.
 </para>
 <para>
   Downloaded data will be stored in data.bin file in the current